﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Web;
using MicropleSoft.WmsServiceLibrary.Common;
using MicropleSoft.WmsServiceLibrary.Models;
using MicropleSoft.WmsServiceLibrary.Security;
using MicropleSoft.WmsServiceLibrary.ServiceFactory;

namespace MicropleSoft.Web
{
    public partial class ServiceFacade
    {
        #region Implementation of IServiceFacade

        public DataTableWrap GetStaticDataTableWrapByItemClass(string classNumber)
        {
            return this.CreateAbstractServiceFactory().CreateDataTableWrapHandler().
                GetStaticDataTableWrapByItemClass(classNumber);
        }

        public DataTableWrap GetStaticDataTableWrapByItemClass(string classNumber, string dataTableCondition)
        {
            return this.CreateAbstractServiceFactory().CreateDataTableWrapHandler().
                GetStaticDataTableWrapByItemClass(classNumber,dataTableCondition);
        }

        public void SaveStaticDataTable(DataTableWrap dataTableWrap)
        {
            this.CreateAbstractServiceFactory().CreateDataTableWrapHandler().SaveStaticDataTable(dataTableWrap);
        }

        public DataTable QueryDataTable(string tableName, string condition)
        {
            return this.CreateAbstractServiceFactory().CreateDataSetPersist().QueryDataTable(tableName, condition);
        }

        public DataTable SaveDataTable(string tableName, DataTable dataTable)
        {
            return this.CreateAbstractServiceFactory().CreateDataSetPersist().SaveDataTable(tableName, dataTable);
        }

        public DataSet QueryDataSet(List<string> queryStrings)
        {
            return this.CreateAbstractServiceFactory().CreateDataSetPersist().QueryDataSet(queryStrings);
        }

        public DataSet SaveDataSet(DataSet dataSet)
        {
            return this.CreateAbstractServiceFactory().CreateDataSetPersist().SaveDataSet(dataSet);
        }

        public int GetMaxValue(string identityName)
        {
            return this.CreateAbstractServiceFactory().CreateSequenceGenerator().GetMaxValue(identityName);
        }

        public int GetBillNumber(string numberName, string whId, int year, int month, int day)
        {
            return this.CreateAbstractServiceFactory().CreateSequenceGenerator().GetBillNumber(numberName,whId,year,month,day);
        }

        #endregion
    }
}